home *** CD-ROM | disk | FTP | other *** search
- /* Set up a new line style of "nels" elements, with mark and space */
- /* lengths given by arrays "mk" and "sp". */
-
- #include "mathfx.h"
- #include "declare.h"
-
- void fxstyl(nels,mk,sp)
- int nels,mk[],sp[];
- {
- int i;
-
- if ((nels < 0) || (nels > 10)) {
- fatal("Broken lines cannot have <0 or >10 elements");
- }
-
- nms = nels;
- for (i=0; i<nels; i++) {
- mark[i] = mk[i];
- space[i] = sp[i];
- if ((mk[i] < 0) || (sp[i] < 0))
- fatal("Mark and space lengths must be > 0 in FXSTYL");
- }
-
- curel = 0;
- pendn = 1;
- timecnt = 0;
- alarm = mark[curel];
- }
-
- /* Updates line style variables, called whenever alarm goes off */
-
- void fxupd()
- {
- while ( timecnt >= alarm ) {
- if (pendn != 0) {
- pendn = 0;
- timecnt = timecnt - alarm;
- alarm = space[curel];
- }
- else {
- pendn = 1;
- timecnt = timecnt - alarm;
- curel = curel + 1;
- if (curel >= nms) curel = 0;
- alarm = mark[curel];
- }
- }
- }
-
-
-